package cn.lingyangwl.agile.member.constant;

import cn.lingyangwl.framework.cache.core.key.ICacheKey;
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.jetbrains.annotations.NotNull;

import java.util.concurrent.TimeUnit;

/**
 * @author shenguangyang
 */
@Getter
@AllArgsConstructor
public enum MemberCacheKey implements ICacheKey {
    /**
     * 会员等级锁, 用于创建默认等级时加锁
     */
    LEVEL_LOCK("member_level_lock_%s", -1, null),
    LEVEL_DATA("member_level_data", 24, TimeUnit.HOURS),
    /**
     * 会员等级变更
     */
    UPDATE_USER_LEVEL("member_user_level_update:%s", -1, null);

    private final String key;
    private final int expire;
    private final TimeUnit unit;

    @Override
    @NotNull
    public String getKey() {
        return key;
    }

    @Override
    public int getExpire() {
        return expire;
    }

    @Override
    public TimeUnit getUnit() {
        return unit;
    }
}
